package com.yidian.mapper;

import com.yidian.entity.Channel;
import com.yidian.entity.User;
import com.yidian.entity.UserExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface UserMapper {
    int countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    User selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 根据用户ID查询该用户的频道信息
     * @param id
     * @return
     */
    List<Channel> selectChannelByUserId(@Param("userId") long id);

    /**
     * 关注用户
     * @param upId
     * @param id
     * @return
     */
    int addFollow (@Param("upId")long upId, @Param("id") long id);

    /**
     * 根据ID取消关注的用户
     * @param upId
     * @param id
     * @return
     */
    int deleteFollow(@Param("upId") long upId,@Param("id") long id);


}